#pragma once

#include "my_defs.h"

#define FNV64_OFFSET                14695981039346656037UL
#define FNV64_PRIME                 1099511628211UL

#define my_fnv64_init(fnv_hash)     \
    fnv_hash = FNV64_OFFSET

static inline void
my_fnv64_update(uint64_t *fnv_hash, const u_char *data, size_t len) {
    uint64_t hash = *fnv_hash;

    while(len--) {
        hash *= FNV64_PRIME;
        hash ^= *data++;
    }

    *fnv_hash = hash;
}